package com.ishopping.api.manage.service;

import com.ishopping.api.manage.entity.Permission;
import com.ishopping.common.core.base.service.IBaseService;
import com.ishopping.common.core.vo.TreeNode;

import java.util.List;

public interface IPermissionService extends IBaseService<Permission> {
    /**
     * 通过用户id获取用户所具备的权限
     * @param userId
     * @param resourceType
     * @return List<Permission>
     */
    List<Permission> findPermissionsByUserId(Long userId, String resourceType);

    /**
     * 通过用户id获取用户所具备的权限
     * @param userId
     * @return List<Permission>
     */
    List<Permission> findPermissionsByUserId(Long userId);

    /**
     * 获取菜单下的操作资源
     * @param menuId
     * @return List<Permission>
     */
    List<Permission> findOperationsByMenuId(Long menuId);

    /**
     * 获取菜单信息
     * @return List<Permission>
     */
    List<Permission> findMenus();

    /**
     * 加载权限树
     * @return List<TreeNode>
     */
    List<TreeNode> findTree(Long roleId);
}
